<?php
/**
* @package YARBB
* @copyright Авторские права (C) 2009 www.yar-it.com. Все права защищены.
* @license Лицензия http://www.gnu.org/licenses/gpl-2.0.htm GNU/GPL, или help/license.php
* YARBB! - свободное программное обеспечение распространяемое по условиям лицензии GNU/GPL
* Для получения информации о используемых расширениях и замечаний об авторском праве, смотрите файл copyright.php.
*/

	defined( '_JEXEC' ) or die( 'Restricted Access' );
	global $ybbConfig;
	$dispclr = $this->theme;
	$userArray = array();
?>

<form action="<?php echo $this->action; ?>" method="post" name="FrmPostlist" id="FrmPostlist">
  <div class="ybbmaindiv">
    <table class="ybbnormaltable" cellpadding=0 cellspacing=0>
      <tr>
        <td class="ybbtopleft"></td>
        <td class="ybbtopmiddle">&nbsp;<?php echo $ybbConfig->boardname;?> </td>
        <td class="ybbtopright"></td>
      </tr>
      <tr>
        <td class="ybbleftbody"></td>
        <td class="ybbheaderrow"><table class="ybbnormaltable" cellpadding="5" cellspacing="5">
            <tr>
               <td><div id="yarbb_menu">
                <ul id="ybbmenu">
                  <?php echo $this->userprofile['home']; ?>
                  <li class="node"><a>Инструменты</a>
                    <ul>
                      <?php echo $this->userprofile['latest']; ?> 
					  <?php echo $this->userprofile['link']; ?> 
					  <?php echo $this->userprofile['mylist']; ?> 
					  <?php echo $this->userprofile['approval']; ?>
                    </ul>
                  </li>
                </ul>
              </div></td>
              <td class="ybbheaderusername"><?php echo JText::_('WELCOME') . ' ' .  $this->userprofile['boardusername']; ?></td>
              <td class="ybbheaderavatar"><?php echo $this->userprofile['thumb']; ?></td>
            </tr>
          </table></td>
        <td class="ybbrightbody"></td>
      </tr>
      <?php foreach($this->sticky as $rec ) { ?>
      <tr>
        <td class="ybbleftbody"></td>
        <td class="ybbheaderrow"><table class="ybbnormaltable" cellpadding="0" cellspacing="0">
            <tr>
              <td class="ybbtopicicon"><img src="<?php echo YARBB_ASSETS_URL_THEME.'/'.$dispclr; ?>/img/sticky<?php echo $rec->topic_type; ?>.gif" class="ybbiconimg" alt="sticky" /></td>
              <td class="ybblinetop"><a href="<?php echo JRoute::_($this->posturl .'&forum=' . (int)$rec->forum_id . '&topic=' . (int)$rec->id .'&Itemid=' . $ybbConfig->itemid ); ?>"> <b><?php echo $this->escape($rec->post_subject); ?></b> </a>&nbsp; </td>
              <td class="ybbfrmlast"><?php
								if( $rec->post_time != 0 ) {
									if( $rec->post_user > 0 ) {
										if( isset( $userArray[$rec->post_user])) {
											$uname = $userArray[$rec->post_user][0];
										} else {
											$uobj = yarbbHelperConfig::getUserProfile( $rec->post_user );
											$userArray[$rec->post_user][0] = $uobj['username'];
                                            $userArray[$rec->post_user][1] = $uobj['thumb'];
                                            $uname = $uobj['username'];
										}
                                        $uname = '<a href="'. JRoute::_('index.php?option=com_yarbb&view=myprofile&cid=' . $rec->post_user . '&Itemid=' . $ybbConfig->itemid ) . '">' . $uname . '</a>';
									} else {
										$uname = $rec->post_username;
									}
								}
								echo JText::_('POST_LIST_BY') . '&nbsp;<b>'. $uname . '</b>&nbsp;' . JText::_('POST_LIST_ON') . '&nbsp;' .
										JHTML::_('date', $rec->post_time + $ybbConfig->timeoffset, $ybbConfig->dateformat);
							?>
              </td>
            </tr>
          </table></td>
        <td class="ybbrightbody"></td>
      </tr>
      <?php } ?>
      <tr class="ybbtablefooter">
        <td class="ybbbotleft"></td>
        <td class="ybbbotmiddle"></td>
        <td class="ybbbotright"></td>
      </tr>
      <tr>
        <td colspan="3" class="ybbtpkmenu"><table class="ybbnormaltable" cellpadding="0" cellspacing="0">
            <tr>
              <?php if( $this->postingAllowed) { ?>
              <td class="ybbtpkmenucol"><a rel="nofollow" class="ovalbutton" href="<?php echo $this->newtopic; ?>"> <span><?php echo  $this->labels['newtopic']; ?></span> </a> </td>
              <?php }	?>
              <td class="ybbtpkpages"><?php if(count($this->items) > 0 ) echo $this->pagination->getPagesLinks(); ?>
              </td>
            </tr>
          </table></td>
      </tr>
      <tr>
        <td class="ybbtopleft"></td>
        <td class="ybbtopmiddle">&nbsp;<?php echo $this->escape($this->forum_name);?> </td>
        <td class="ybbtopright"></td>
      </tr>
      <tr>
        <td class="ybbleftbody"></td>
        <td class="ybbtpkdetail"><table class="ybbnormaltable" cellpadding="4" cellspacing="0">
            <tr>
              <td class="ybbfrmrowcol1"></td>
              <td class="ybbfrmrowcol6"></td>
              <td class="ybbfrmrowcol2"><b><?php echo $this->labels['topics']; ?></b></td>
              <td class="ybbtpkcol3"><b><?php echo $this->labels['replies']; ?></b></td>
              <td class="ybbtpkcol3"><b><?php echo $this->labels['views']; ?></b></td>
              <?php if( $ybbConfig->showtopicavatar > 0) { ?>
              <td class="ybbheaderavatar">&nbsp;</td>
              <?php } ?>
              <td class="ybbfrmrowcol5"><b><?php echo $this->labels['lastpost']; ?></b></td>
            </tr>
            <?php
					$i=1;
					foreach ($this->items as $item) {
					?>
            <tr>
              <td class="ybbfrmrowcol1"><img src="<?php echo YARBB_ASSETS_URL_THEME.'/'.$dispclr; ?>/img/topic<?php if($item->locked == 1) echo '-locked'; ?>.gif" alt="topic" /> </td>
              <td class="ybblinetop" style="text-align: center;"><?php
									if( $item->topic_emoticon) {
										echo '<img src="' .  YARBB_ASSETS_URL_THEME.'/'.$dispclr.'/topic_icon/' . $item->topic_emoticon . '.gif" alt="topic_icon" />';
									}
			 					?>
              </td>
              <td class="ybblinetop" align="left"><a href="<?php echo JRoute::_($this->posturl . '&forum='.(int)$item->forum_id.'&topic='.(int)$item->id.'&Itemid=' . $ybbConfig->itemid); ?>"> <b><?php echo $this->escape($item->post_subject); ?></b> </a><br />
                <?php
									if( $item->post_user > 0 ) {
										if( isset( $userArray[$item->post_user])) {
											$uname = $userArray[$item->post_user][0];
										} else {
											$uobj = yarbbHelperConfig::getUserProfile( $item->post_user );
											$userArray[$item->post_user][0] = $uobj['username'];
                                            $userArray[$item->post_user][1] = $uobj['thumb'];
                                            $uname = $uobj['username'];
										}
                                        $uname = '<a rel="nofollow" href="'. JRoute::_('index.php?option=com_yarbb&view=myprofile&cid=' . $item->post_user . '&Itemid=' . $ybbConfig->itemid ) . '">' . $uname . '</a>';
									} else {
										$uname = $item->post_username;
									}
									echo JText::_('POST_LIST_BY') . '&nbsp;'. $uname . '&nbsp;' . JText::_('POST_LIST_ON') . '&nbsp;' .
										JHTML::_('date', $item->post_time + $ybbConfig->timeoffset, $ybbConfig->dateformat);
			 					?>
              </td>
              <td class="ybblinetop" align="center"><?php echo (int)$item->reply_count; ?></td>
              <td class="ybblinetop" align="center"><?php echo (int)$item->hits; ?></td>
              <?php
                                $uthumb = '<span class="topicavatar">
								<img src="components/com_yarbb/assets/avatar/avatar1.png" style="height: ' . $ybbConfig->smallavatarheight . 'px; width: ' . $ybbConfig->smallavatarwidth . 'px;" /></span>';
                                if( $item->last_post_user > 0 ) {
                                    if( isset( $userArray[$item->last_post_user])) {
                                        $uname = $userArray[$item->last_post_user][0];
                                        $uthumb = $userArray[$item->last_post_user][1];
                                    } else {
                                        $uobj = yarbbHelperConfig::getUserProfile( $item->last_post_user);
                                        $userArray[$item->last_post_user][0] = $uobj['username'];
                                        $userArray[$item->last_post_user][1] = $uobj['thumb'];
                                        $uname = $uobj['username'];
                                        $uthumb = $uobj['thumb'];
                                    }
                                    $uname = '<a rel="nofollow" href="'. JRoute::_('index.php?option=com_yarbb&view=myprofile&cid=' . $item->last_post_user . '&Itemid=' . $ybbConfig->itemid ) . '">' . $uname . '</a>';
                                    $uthumb = '<a rel="nofollow" href="'. JRoute::_('index.php?option=com_yarbb&view=myprofile&cid=' . $item->last_post_user . '&Itemid=' . $ybbConfig->itemid ) . '">' . $uthumb . '</a>';
                                } else {
    								$uname = $item->last_post_username;
                                }
		 					?>
              <?php if( $ybbConfig->showtopicavatar > 0) { ?>
              <td class="ybblinetop" align="center"><?php echo $uthumb; ?> </td>
              <?php } ?>
              <td class="ybblinetop" align="left"><?php
                                    //echo '<a href="' . JRoute::_($this->posturl . '&forum='. $item->id .'&topic='. (int) $item->id . '&Itemid=' . $ybbConfig->itemid . yarbbHelperConfig::getPageNumber($item->id, $item->last_post_id)) . '">' . $this->escape($item->last_post_subject) . '<a/>&nbsp;';
                                    
                                    echo '<a href="' . JRoute::_($this->posturl . '&forum='. $item->id .'&topic='. (int) $item->id . '&Itemid=' . $ybbConfig->itemid . yarbbHelperConfig::getPageNumber($item->id, $item->last_post_id)) .  '" title="'.$this->escape($item->last_post_subject).'">';
									
									if (strlen($this->escape($item->last_post_subject)) > '25') {
											
                                            echo JString :: substr($this->escape($item->last_post_subject), 0, '25').'...' .'&nbsp;';
											
											} else {
											echo $this->escape($item->last_post_subject).'&nbsp;';
											}
											
								
                                    echo '<img src="' . YARBB_ASSETS_URL_THEME.'/'.$dispclr.'/img/lastpost.gif" alt="lastpost" />';
                                    echo '</a><br/>';
                                    echo JText::_('POST_LIST_BY') . '&nbsp;<b>'. $uname . '</b><br />';
                                    echo JText::_('POST_LIST_ON') . '&nbsp;' . JHTML::_('date', $item->last_post_time+ $ybbConfig->timeoffset, $ybbConfig->dateformat);
                                ?>
              </td>
            </tr>
            <?php
					}
					?>
          </table></td>
        <td class="ybbrightbody"></td>
      </tr>
      <tr class="ybbtablefooter">
        <td class="ybbbotleft"></td>
        <td class="ybbbotmiddle"></td>
        <td class="ybbbotright"></td>
      </tr>
      <tr>
        <td colspan="3" class="ybbtpkmenu"><table class="ybbnormaltable" cellpadding="0" cellspacing="0">
            <tr>
              <td class="ybbtpkmenucolbot"><?php if( $this->postingAllowed) { ?>
                <a rel="nofollow" class="ovalbutton" href="<?php echo $this->newtopic; ?>"> <span><?php echo  $this->labels['newtopic']; ?></span> </a>
                <?php }	?>
                <?php if(count($this->items) > 0 ) { echo JText::_('PAGE') . ' #&nbsp;'; echo $this->pagination->getLimitBox(); } ?>
              </td>
              <td class="ybbtpkpages"><?php if(count($this->items) > 0 ) echo $this->pagination->getPagesLinks(); ?>
              </td>
            </tr>
          </table></td>
      </tr>
    </table>
    <?php
?>
    <input type="hidden" name="option" value="com_yarbb" />
    <input type="hidden" name="forum" value="<?php echo $this->forum_id; ?>" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="filter_order" value="<?php echo $this->filter_order; ?>" />
    <input type="hidden" name="filter_order_Dir" value="<?php echo $this->filter_orderDir; ?>" />
  </div>
  <br/>
</form>
<?php echo YARBB_COPYRIGHT; ?> <br/>
